package de.urw.app;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;

import android.util.Log;

public class URWKit {
	String modulePath;
	ModuleLoader ml;
	public XMLParser xmlp;
	ArrayList<URWKitObject> objects ;
	HashMap<String, Class<?>> modules;
	public URWKit(String path){
		modulePath = path;
		objects = new ArrayList<URWKitObject>();
	}
	

	public void loadModules(){
		Log.d("test", "start loading");
		ml = new ModuleLoader(modulePath);
		Log.d("test", "initialized moduleloader");
		modules = ml.createIndex();
	}


	public void readXML(InputStream XML){
		xmlp = new XMLParser(XML, new XMLObjectLinker(modules, objects));
		xmlp.parse();
	}


	public void render(RenderEngine renderEngine){
		int l = this.objects.size();
		for (int i = 0; i < l; i++) {
			URWKitObject urwko = this.objects.get(i);
			urwko.render(renderEngine);
			
		}
	}
	


	
}
